During the drilling phase of the construction of a hydrocarbon wellbore, the length of the drillstring in the borehole is used to estimate the measured depth (or along hole length) of a borehole, it is assumed that the pipe is inelastic and therefore does not stretch. However, discrepancies in the length of the borehole estimated at surface during rig operations and the actual length of the borehole there may cause gaps or lost data, when the uncorrected depth is used with logs of data measured during drilling with sensors mounted on the drillstring, such as LWD and MWD logs.